package collection.Demo08;

/**
 * @Author Miku
 * @Create 2021/4/16 14:36
 */
public class TestGeneric {
    public static void main(String[] args) {
        //使用泛型类创建String对象
        MyGeneric<String> myGeneric = new MyGeneric<>();
        myGeneric.t = "Hello";
        myGeneric.show("miku");
        System.out.println(myGeneric.getT());

        //使用泛型类创建Integer对象
        MyGeneric<Integer> myGeneric1 = new MyGeneric<>();
        myGeneric1.t = 123;
        myGeneric1.show(10000);
        System.out.println(myGeneric1.getT());

        //泛型接口测试
        MyInterfaceImpl myInterface = new MyInterfaceImpl();
        myInterface.server("miku miku dance");

        MyInterfaceImpl2<Integer> impl2 = new MyInterfaceImpl2<>();
        impl2.server(321);

        //泛型方法测试
        MyGenericMethod myGenericMethod = new MyGenericMethod();
        myGenericMethod.show("123");
        myGenericMethod.show(100);
        myGenericMethod.show(3.14);

    }
}
